//      <th>" . $this->translate('name') . "</th>
//      <th>" . $this->translate('rating') . "</th>
//      <th>" . $this->translate('movieReleaseDate') . "</th>

function doSearch() {

	var divRes = document.getElementById('resTable');
//	divRes.innerHTML = "<table>" + "<tr>"
//			+ "<th>name</th><th>rating</th><th>movieReleaseDate</th>" + "</tr>"
//			+ "<tr>" + "<td>a1</td>" + "<td>a2</td>" + "<td>a3</td>" + "</tr>"
//			+ "<tr>" + "<td>b1</td>" + "<td>b2</td>" + "<td>b3</td>" + "</tr>"
//			+ "</table>";
	divRes.innerHTML = "Recherche...";
	
	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp = new XMLHttpRequest();
	}
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		    //document.getElementById("myDiv").innerHTML=
//		    alert(xmlhttp.responseText);
		    
		    var result = JSON.parse(xmlhttp.responseText);
		    
		    if (result.code == 0) {
		    	var table = "";
		    	var len = result.len;
		    	var movies = result.movies;
		    	
		    	table += "<table><tr><th>name</th></tr>"; // <th>rating</th><th>movieReleaseDate</th>
		    	for (var i = 0 ; i < len ; ++i) {
		    		table += '<tr><td>' + movies[i].name + '</td></tr>';
		    	}
		    	table += '</table>';
				var divRes = document.getElementById('resTable');
			    divRes.innerHTML = table;//"OK..." + result.code;
		    }
	    }
	};
//	var params = "action=auth&email=123&pass=123";
//	xmlhttp.open("GET", "mediasearch/search/index", true);
	xmlhttp.open("GET", "php/mediasearch/search.php", true);
	xmlhttp.send();
}

